package com.springcloud.order.downgrade;

import com.springcloud.order.openfeign.UserClient;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserClientFallbackFactory implements FallbackFactory<UserClient> {

    @Override
    public UserClient create(Throwable throwable) {
        return new UserClient() {
            @Override
            public String getUser(String id) {
                String message = throwable.getMessage();
                return message;
            }
        };
    }
}
